<?php /*a:2:{s:103:"G:\ssssss\eeeee\phpstudy_pro\WWW\zhengmaotong\public/themes/admin_simpleboot3/zmt\goods\goods_attr.html";i:1718589436;s:96:"G:\ssssss\eeeee\phpstudy_pro\WWW\zhengmaotong\public/themes/admin_simpleboot3/public\header.html";i:1690974980;}*/ ?>
<!--第一种增添方式-->
<!--<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->


    <link href="/themes/admin_simpleboot3/public/assets/themes/<?php echo cmf_get_admin_style(); ?>/bootstrap.min.css" rel="stylesheet">
    <link href="/themes/admin_simpleboot3/public/assets/simpleboot3/css/simplebootadmin.css" rel="stylesheet">
    <link href="/static/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        form .input-order {
            margin-bottom: 0px;
            padding: 0 2px;
            width: 42px;
            font-size: 12px;
        }

        form .input-order:focus {
            outline: none;
        }

        .table-actions {
            margin-top: 5px;
            margin-bottom: 5px;
            padding: 0px;
        }

        .table-list {
            margin-bottom: 0px;
        }

        .form-required {
            color: red;
        }

        .td-actions .btn {
            margin-bottom: 2px;
            min-width: 96px;
            text-align: center;
        }

        .td-actions .btn:last-child {
            margin-bottom: 0;
        }
        a:hover, a:focus{
            text-decoration: none;
        }
    </style>
    <?php 
		$is_mobile=cmf_is_mobile();
        $_static_version='1.0.4';
        $cmf_version=cmf_version();
        if (strpos(cmf_version(), '6.') === 0) {
            $_app=app()->http->getName();
        }else{
            $_app=request()->module();
        }
     ?>
    <script type="text/javascript">
        //全局变量
        var GV = {
            ROOT: "/",
            WEB_ROOT: "/",
            JS_ROOT: "static/js/",
            APP: '<?php echo $_app; ?>'/*当前应用名*/,
            IS_MOBILE: <?php echo !empty($is_mobile) ? 'true'  :  'false'; ?>
        };
    </script>
    <script src="/themes/admin_simpleboot3/public/assets/js/jquery-1.12.4.min.js"></script>
    <script src="/themes/admin_simpleboot3/public/assets/js/jquery-migrate-1.4.1.min.js"></script>
<!--    <script src="/themes/admin_simpleboot3/public/assets/js/jquery-3.6.0.min.js"></script>-->
    <script src="/static/js/wind.js"></script>
    <script src="/themes/admin_simpleboot3/public/assets/js/bootstrap.min.js"></script>
    <script>
        Wind.css('artDialog');
        Wind.css('layer');
        $(function () {
            $("[data-toggle='tooltip']").tooltip({
                container: 'body',
                html: true,
            });
            $("li.dropdown").hover(function () {
                $(this).addClass("open");
            }, function () {
                $(this).removeClass("open");
            });
        });
    </script>
    <?php if(APP_DEBUG): ?>
        <style>
            #think_page_trace_open {
                z-index: 9999;
            }
        </style>
    <?php endif; ?>
-->
<!--</head>-->
<!--<body>-->
<!--	<div class="wrap">-->
<!--		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="<?php echo url('goods/setGoodsAttrPost'); ?>">-->
<!--			<div id ='form-item-box'>-->
<!--				<div class="form-group">-->
<!--					<label class="col-sm-2 control-label">属性<span class="form-required">*</span></label>-->
<!--					<div class="col-md-6 col-sm-10">-->
<!--						<input type="text" class="form-control"  name="attr[]">-->
<!--					</div>-->
<!--				</div>-->
<!--			</div>-->
<!--			<div class="form-group">-->
<!--				<label  class="col-sm-2 control-label"></label>-->
<!--				<div class="col-md-6 col-sm-10">-->
<!--					<button type="button" onclick="addFormItem()" class="btn btn-default ">增加表单项</button>-->
<!--				</div>-->
<!--			</div>-->
<!--			<input type="hidden" name="goods_id" value="<?php echo $goods_id; ?>">-->
<!--			<div class="form-group">-->
<!--				<div class="col-sm-offset-2 col-sm-10">-->
<!--					<button type="submit" class="btn btn-primary js-ajax-submit">保存</button>-->
<!--					<a class="btn btn-default" href="javascript:history.back(-1);">返回</a>-->
<!--				</div>-->
<!--			</div>-->
<!--		</form>-->
<!--	</div>-->
<!--	<script>-->
<!--		function addFormItem() {-->
<!--			//获取大盒子-->
<!--			const formItemBox = document.getElementById('form-item-box')-->
<!--			//创建input-->
<!--			const input =document.createElement('input')-->
<!--			input.type = 'text'-->
<!--			input.className='form-control'-->
<!--			input.name = 'attr[]'-->

<!--			//创建删除按钮-->
<!--			const removeButton = document.createElement('button')-->
<!--			removeButton.className = 'btn btn-danger btn-sm'-->
<!--			removeButton.innerText = '移除'-->
<!--			removeButton.type = 'button'-->
<!--			removeButton.onclick = function (){-->
<!--				removeFormItem(this)-->
<!--			}-->
<!--			//创建input,button的父元素-->
<!--			const inputParent = document.createElement("div")-->
<!--			inputParent.className = 'col-md-6 col-sm-10'-->
<!--			inputParent.style.display = 'flex'-->
<!--			inputParent.appendChild(input)-->
<!--			inputParent.appendChild(removeButton)-->
<!--			//创建label标签-->
<!--			const label = document.createElement('label')-->
<!--			label.className = 'col-sm-2 control-label'-->
<!--			label.innerText = '属性'-->
<!--			//创建最外层的div-->
<!--			const formGroupDiv = document.createElement("div")-->
<!--			formGroupDiv.className = 'form-group'-->
<!--			formGroupDiv.appendChild(label)-->
<!--			formGroupDiv.appendChild(inputParent)-->
<!--			//formGroupDiv.appendChild(formGroupDiv)-->

<!--			formItemBox.appendChild(formGroupDiv)-->
<!--		}-->
<!--		//移除表单项-->
<!--		function removeFormItem(button){-->
<!--			//获取大盒子-->
<!--			const formItemBox = document.getElementById('form-item-box')-->
<!--			formItemBox.removeChild(button.parentNode.parentNode)-->
<!--		}-->
<!--	</script>-->
<!--	<script src="/static/js/admin.js?v=<?php echo $_static_version; ?>"></script>-->
<!--	<script type="text/javascript">-->
<!--		//编辑器路径定义-->
<!--		var editorURL = GV.WEB_ROOT;-->
<!--	</script>-->
<!--	<script type="text/javascript" src="/static/js/ueditor/ueditor.config.js"></script>-->
<!--	<script type="text/javascript" src="/static/js/ueditor/ueditor.all.min.js"></script>-->
<!--	<script type="text/javascript">-->
<!--		var editorcontent = new baidu.editor.ui.Editor();-->
<!--		editorcontent.render('input-content');-->
<!--	</script>-->
<!--</body>-->
<!--</html>-->
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<!-- 引入样式 -->
	<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app" style="margin: 20px 60px">
	<el-form :inline="true" :model="form" >
		<div v-for="(item,index) in form">
			<el-form-item :label="'属性' + (index +1)">
					<el-input v-model="item.name" placeholder="请输入属性"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="danger" @click="removeFormItem(index)">移除</el-button>
			</el-form-item>
		</div>
		<div>
			<el-form-item>
				<el-button type="default" @click="addFormItem">增加属性</el-button>
			</el-form-item>
		</div>
		<div>
			<el-form-item>
				<el-button type="primary" @click="submitForm">保存</el-button>
			</el-form-item>
		</div>
	</el-form>
</div>
<!-- import Vue before Element -->
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
	v = new Vue({
		el:"#app",
		data:{
			//商品ID
			goods_id:"<?php echo $goods_id; ?>",
			form:[
				{name:''},
			]
		},
		methods:{
			//增加表单项
			addFormItem(){
				this.form.push({
					attr:'',
				})
			},
			//移除表单项
			removeFormItem(index){
				this.form.splice(index,1)
			},
			//提交表单
			submitForm(){
				$.ajax({
					url:"<?php echo url('goods/setGoodsAttrPost'); ?>",
					type:"POST",
					data:{
						goods_id:this.goods_id,
						attr:this.form,
					},
					success(res){

					},
					error(){
						alert('请求失败')
					}
				})
			}
		},
		created(){
			$.ajax({
				url:"<?php echo url('goods/getGoodsAttr'); ?>",
				data:{
					goods_id:this.goods_id
				},
				success(res){
					console.log(res)
					v.selectOptions =res.data
				},
				error(){
					alert('请求失败')
				}
			})
		}
	})
</script>
</body>

</html>
